function [firstpos,las]=getpos(imageref,imagesec)
        
       % se calcula la primera matriz
       [firstpos,las]=roiselect(2.3 ,2.3 ,imageref);
       
       %siguiente funcion para la minimizacion con AG para alineamiento
       
       
       x=[0 0];
        I=imread(imageref);
        li=rgb2gray(I);
        Im=imread(imagesec);
        lis=rgb2gray(Im);
        
      ObjectiveFunction  = @(x) getpospoint(firstpos,las,x,lis,li);
      nvars=2;
      LB=[-0.9 -0.9];
      UB=[0.9 0.9];
      
      %aplicacion del algoritmo genetico
      %----------------------------------------
      %X0 = [0.0 0.0]; % Start point (row vector)
      %options = gaoptimset('InitialPopulation',X0,'UseParallel','always');
      %[x,fval] = ga(ObjectiveFunction,nvars,[],[],[],[],LB,UB,[],options)         
      %Ias= getpospoint2(firstpos,las,x,lis,li);
      
      %aplicacion del algoritmo genetico 2
      %----------------------------------------
        ga2(15,2,8,[-1,1;-1,1],firstpos,las,lis,li);
      %-------------------------------------------
      %
      %aplicacion del algoritmo genetico con inspiracion cuantica
      %----------------------------------------
        %ga2Q(15,2,8,[-1,1;-1,1],firstpos,las,lis,li);
      %-------------------------------------------
      %
     %finsearch 
     %-------------------------------------------
     
     %[x]=fminsearch(ObjectiveFunction,X0);         
     %Ias= getpospoint2(firstpos,las,x,lis,li);
     %x
     %-------------------------------------------
     
      %for i=1:0.5:2
      %    Ias=getpospoint2(firstpos,las,x,lis,li);
      %    x=x+i
      %     figure, imshow(Ias);
      %end
      
      % [x,fval] = ga(ObjectiveFunction,nvars,[],[],[],[],LB,UB,ConstraintFunction)
     %figure, imshow(Ias);
end
